package edu.kit.aifb.lidasora.sesame;

import org.openrdf.model.URI;
import org.openrdf.query.GraphQueryResult;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.QueryLanguage;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.sail.memory.MemoryStore;

public class SesameRepository {

	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Repository myRepository = new SailRepository(new MemoryStore());
		URI uri = myRepository.getValueFactory().createURI("http://education.data.gov.uk/def/school/");
		myRepository.
		try {
			myRepository.initialize();
		} catch (RepositoryException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		RepositoryConnection con = null;
		try {
			con = myRepository.getConnection();
		} catch (RepositoryException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			GraphQueryResult graphResult = con.prepareGraphQuery(
				      QueryLanguage.SERQL, "CONSTRUCT * FROM {x} p {y}").evaluate();
			System.out.println(graphResult.toString());
		} catch (QueryEvaluationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RepositoryException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedQueryException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
